package com.kaifamiao.month04.day06;

public class Person implements Cloneable{

    public String name;
    public Pet pet;

    public Object clone() throws CloneNotSupportedException {
//        Object clone = super.clone();
        Person p = new Person();
        p.name = this.name;
        p.pet = (Pet)this.pet.clone();
        return p;
    }

//    public String toString() {
//        return name + "的宠物是：" + pet.name;
//    }
}
